package com.github.McPlugin.inventory;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.HashMap;
import java.util.Map;



public class storeInventory{
    private Map<String, Inventory> guiMap;
    private Map<Player, Map<ItemStack, Inventory>> categoryGuiMap;
    private FileConfiguration languageConfig;
    private FileConfiguration shopConfig;

    public void openInventory(Player player){
        if(!guiMap.containsKey(player.getUniqueId().toString())){
            loadGui(player);
        }
        player.openInventory(guiMap.get(player.getUniqueId().toString()));
    }

    public void loadGui(Player player) {
        categoryGuiMap.put(player, new HashMap<>());
        Inventory gui = Bukkit.createInventory(player, 54, ChatColor.AQUA + "Scoreboard Store");

        // 关闭
        setClose(gui);

        // 分类


        guiMap.put(player.getUniqueId().toString(), gui);
    }

    private void setClose(Inventory itemGui) {
        ItemStack close = new ItemStack(Material.BARRIER);
        ItemMeta closeMeta = close.getItemMeta();
        closeMeta.setDisplayName(languageConfig.get("close").toString());
        close.setItemMeta(closeMeta);

        itemGui.setItem(53, close);
    }

}
